Can we issue a buy/sell recommendation of bitcoin on a 7days holding period?
How much data history do we need?
We used an external Python script to scrape the website www.coinmarketcap.com
Besides technical analysis on the stock, we also wanted to include a trend factor with our data so we looked at Google Trend.
Our hypothesis was that there is a strong correlation between google searches and stock prices.
After scrapping coinmarketcap website, we had the following data:
We also managed to download google data using a specific R library.
scrapGTrendsForKeywords(c("BTC","ETH","XRP","EOS","LTC"), "gtrends.csv")
Atht he moment we are unable to sort our currency by market cap.
plotGTrends(google.trends)
The initial part of the analysis is to be able to create a new dataframe that will contain the total history of the market and useful indicators for technical analysis.
## [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
## [24] 24 25
plotGTrendsIssue(google.trends)
We build these categorical variables on different lag periods (7,14,21 days).
We start by building our features on each independent coins.
btcValues = coinDataEngineering("BTC")
## [BTC] Feature engineering on full dataset for
## [BTC] SMA20 [Done]
## [BTC] Volatility [Done]
## [BTC] Volume [Done]
## [BTC] Momemtum [Done]
## [BTC] BuyResult [Done]
## [BTC] GoogleTrends [Done]
ethValues = coinDataEngineering("ETH")
## [ETH] Feature engineering on full dataset for
## [ETH] SMA20 [Done]
## [ETH] Volatility [Done]
## [ETH] Volume [Done]
## [ETH] Momemtum [Done]
## [ETH] BuyResult [Done]
## [ETH] GoogleTrends [Done]
xrpValues = coinDataEngineering("XRP")
## [XRP] Feature engineering on full dataset for
## [XRP] SMA20 [Done]
## [XRP] Volatility [Done]
## [XRP] Volume [Done]
## [XRP] Momemtum [Done]
## [XRP] BuyResult [Done]
## [XRP] GoogleTrends [Done]
ltcValues = coinDataEngineering("LTC")
## [LTC] Feature engineering on full dataset for
## [LTC] SMA20 [Done]
## [LTC] Volatility [Done]
## [LTC] Volume [Done]
## [LTC] Momemtum [Done]
## [LTC] BuyResult [Done]
## [LTC] GoogleTrends [Done]
eosValues = coinDataEngineering("EOS")
## [EOS] Feature engineering on full dataset for
## [EOS] SMA20 [Done]
## [EOS] Volatility [Done]
## [EOS] Volume [Done]
## [EOS] Momemtum [Done]
## [EOS] BuyResult [Done]
## [EOS] GoogleTrends [Done]
btcResults = doLogisticReg(btcValues)
ethResults = doLogisticReg(ethValues)
xrpResults = doLogisticReg(xrpValues)
ltcResults = doLogisticReg(ltcValues)
eosResults = doLogisticReg(eosValues)
## Name=bitcoin && auc=0.576094674556213 && accuracy=0.561538461538462 && specificity=0.523076923076923 && sensitivities=0.6
## Name=ethereum && auc=0.497589199614272 && accuracy=0.449612403100775 && specificity=0.39344262295082 && sensitivities=0.5
## Name=ripple && auc=0.725316455696203 && accuracy=0.705426356589147 && specificity=0.66 && sensitivities=0.734177215189873
## Name=litecoin && auc=0.589240824534942 && accuracy=0.565891472868217 && specificity=0.509803921568627 && sensitivities=0.602564102564103
## Name=eos && auc=0.77 && accuracy=0.75 && specificity=0.9 && sensitivities=0.6
| Name | Accuracy | Sensitivities | Specificities | AUC |
|---|---|---|---|---|
| bitcoin | 0.561538461538462 | 0.6 | 0.523076923076923 | 0.5760947 |
| ethereum | 0.449612403100775 | 0.5 | 0.39344262295082 | 0.4975892 |
| ripple | 0.705426356589147 | 0.734177215189873 | 0.66 | 0.7253165 |
| litecoin | 0.565891472868217 | 0.602564102564103 | 0.509803921568627 | 0.5892408 |
| eos | 0.75 | 0.6 | 0.9 | 0.7700000 |
TODO
We have built a solid base to complete a better analysis in the future. Here is a list of topics we can investigate building on our current status: